package Operation;

public class ParameterPass {
    public static void main(String[] args) {
        Dog dog = new Dog("A");
        System.out.println(dog.getObjectAddress()); // Dog@3b07d329
        func(dog);
        System.out.println(dog.getObjectAddress()); // Dog@3b07d329
        System.out.println(dog.getName());          // A
    }

    private static void func(Dog dog) {
        dog.setName("B");
        System.out.println(dog.getObjectAddress()); // Dog@3b07d329
        dog = new Dog("B");
        System.out.println(dog.getObjectAddress()); // Dog@41629346
        System.out.println(dog.getName());          // B
    }
}
